control
Class Community

java.lang.Object
  extended by control.Community

public class Community
extends java.lang.Object

This class permits to create the Cartesian product of all community states and all final states of a set of available services


Field Summary
private  AvailableServices availableService
           
private  java.util.Set<CState> CFStates
           
private  java.util.Set<CState> CStates
           
 
Constructor Summary
Community(AvailableServices as)
           
 
Method Summary
private  void createCommunityStates(Service s, int loop, CState CSRecord)
          creates all states of the community as a Cartesian product of states of available services
private  void createFinalCommunityState(Service s, int loop, CState CSRecord)
          creates all final states of the community as a Cartesian product of final states of available services
 java.util.Iterator<CState> getCommunityStates()
          returns all community states created with a Cartesian product of all states of available services
 java.util.Iterator<CState> getFinalCommunityStates()
          returns community states which are final states as a Cartesian product of all final states of every available services
 CState getInitialStates()
          gets a community state that is final
 Service getService(int index)
          gets the service in the specified position
 int getServicePosition(Service service)
          gets the position of a service in the set of available services
 boolean isFinalCommunityState(CState cs)
          checks if a state of the community is final
 int size()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

availableService

private AvailableServices availableService

CStates

private java.util.Set<CState> CStates

CFStates

private java.util.Set<CState> CFStates
Constructor Detail

Community

public Community(AvailableServices as)
Method Detail

createCommunityStates

private void createCommunityStates(Service s,
                                   int loop,
                                   CState CSRecord)
creates all states of the community as a Cartesian product of states of available services

Parameters:
s - - first service of the community
loop - - the position in a community state where you want to place the states of a service

getCommunityStates

public java.util.Iterator<CState> getCommunityStates()
returns all community states created with a Cartesian product of all states of available services

Returns:
a set of community states

createFinalCommunityState

private void createFinalCommunityState(Service s,
                                       int loop,
                                       CState CSRecord)
creates all final states of the community as a Cartesian product of final states of available services

Parameters:
s - - first service of the community
loop - - the position in a community state where you want to place the states of a service

getFinalCommunityStates

public java.util.Iterator<CState> getFinalCommunityStates()
returns community states which are final states as a Cartesian product of all final states of every available services

Returns:
a set of final community states

getService

public Service getService(int index)
gets the service in the specified position

Parameters:
index - - the position
Returns:
a service

getInitialStates

public CState getInitialStates()
gets a community state that is final

Returns:
CState

getServicePosition

public int getServicePosition(Service service)
gets the position of a service in the set of available services

Parameters:
service - - the service we want to find
Returns:
an integer

isFinalCommunityState

public boolean isFinalCommunityState(CState cs)
checks if a state of the community is final

Parameters:
cs - - the community's state to check
Returns:
true if cs is final

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

size

public int size()